<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // 浅克隆
    // 对象浅克隆
    const obj = {
      a: 10,
      b: 20
    }
    /* // 展开运算符
    var obj2 = {
      ...obj
    }
    obj2.a = 200;
    console.log(obj); */
    // Object.assign
    const obj2 = {
      c: 30,
      d: 40
    }
    const obj3 = Object.assign({}, obj2);
    obj3.c = 500;
    console.log(obj2);

    // 数组浅克隆
    const arr = [1,2,3,4];
    const arr2 = [...arr];
    // 深克隆  lodash clone cloneDeep
  </script>
</body>
</html>